﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MAF.Common
{
    /// <summary>
    /// 值对象基类
    /// </summary>
    public class InfoBase : IID<Guid>
    {
        /// <summary>
        /// 构造方法
        /// </summary>
        public InfoBase()
        {
            CreatedBy = Guid.Empty;
            ModifiedBy = Guid.Empty;
            CreatedOn = DateTime.Now;
            ModifiedOn = DateTime.Now;

            Id = CombGuid.NewGuid();
            Name = string.Empty;

            ParentId = Guid.Empty;
            Parent = null;
            IsFocus = false;

            // 数据持久属性，例如数据表的名字
            PersistenceName = string.Empty;
        }

        #region Properties

        public Guid CreatedBy { get; set; }

        public Guid ModifiedBy { get; set; }

        public DateTime CreatedOn { get; set; }

        public DateTime ModifiedOn { get; set; }
        
        public Guid Id { get; set; }

        public string Name { get; set; }

        [Obsolete("此属性已被Parent属性取代")]
        public Guid ParentId { get; set; }

        public InfoBase Parent { get; set; }

        public bool IsFocus { get; set; }

        public string PersistenceName { get; set; }

        #endregion
    }
}
